﻿using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace practice_while
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //int i = 0;
            //while(i < 20)
            //{
            //    i++;
            //    Console.WriteLine("Hello World");
            //}

            //string name = "张三";
            //string password = "159753abd";



            //i = 0;
            //Console.WriteLine("请输入用户名和密码");
            //while (i < 3)
            //{
            //    Console.Write("用户名: ");
            //    string name1 = Console.ReadLine();
            //    Console.Write("密码: ");
            //    string password1 = Console.ReadLine();
            //    if(name != name1)
            //    {
            //        Console.WriteLine("用户名错误");
            //    }
            //    else if(password != password1)
            //    {
            //        Console.WriteLine("密码错误!");
            //    }
            //    else
            //    {
            //        break;
            //    }
            //    i++;
            //}

            //Console.WriteLine("请输入班级人数: ");
            //int n = Convert.ToInt32(Console.ReadLine());
            //int sum = 0;
            //int tmp = n;
            //int average = 0;
            //while(n != 0)
            //{
            //    int score = Convert.ToInt32(Console.ReadLine());
            //    sum += score;
            //    n--;
            //}
            //Console.WriteLine("总成绩: " + sum);
            //average = sum / tmp;
            //Console.WriteLine("平均成绩: " + average);


            //string input = Console.ReadLine();
            //while (input != "yes" && input != "no")
            //{
            //    Console.Write("请重新输入: ");
            //    input = Console.ReadLine();
            //}

            int i = 1;
            int sum = 0;
            while (i <= 100)
            {
                sum += i++;
            }
            Console.WriteLine(sum);


            Console.ReadKey();

        }
    }
}
